package org.kjtc.balanceService;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.kjtc.balanceEntity.ChargingRecord;
import org.kjtc.balanceEntity.ReviewRecord;
import org.kjtc.service.BaseService;
import org.springframework.stereotype.Service;

@Service("reviewRecordService")
public class ReviewRecordService extends BaseService {

	@SuppressWarnings("unchecked")
	public List<ReviewRecord> getReviewRecord(ReviewRecord reviewRecord) throws Exception{
		return (List<ReviewRecord>)this.getDaoSupport().findForList("T_ReviewRecord.sumReviewRecord",reviewRecord);
	}
	
	@SuppressWarnings("unchecked")
	public List<ReviewRecord> getLineIDList(ReviewRecord reviewRecord) throws Exception{
		return (List<ReviewRecord>)this.getDaoSupport().findForList("T_ReviewRecord.lineIDListInfo", reviewRecord);
	}
	
	@SuppressWarnings("unchecked")
	public List<ChargingRecord> getLineRecordDetail(ChargingRecord chargingRecord) throws Exception{
		return (List<ChargingRecord>)this.getDaoSupport().findForList("T_ReviewRecord.getLineRecordDetail",chargingRecord);
	}
	
	@SuppressWarnings("unchecked")
	public List<ReviewRecord> getReviewedRecord(ReviewRecord reviewRecord) throws Exception{
		return (List<ReviewRecord>)this.getDaoSupport().findForList("T_ReviewRecord.searchReviewedRecord",reviewRecord);
	}
	
	@SuppressWarnings("unchecked")
	public List<ReviewRecord> searchLineKWHEntry(ReviewRecord reviewRecord) throws Exception{
		return (List<ReviewRecord>)this.getDaoSupport().findForList("T_ReviewRecord.searchLineKWHEntry",reviewRecord);
	}
	
	public int saveManualReview(ReviewRecord reviewRecord) throws Exception {
		return (int) this.getDaoSupport().update("T_ReviewRecord.saveManualReview", reviewRecord);
	}
	
	public int updateManualReview(ReviewRecord reviewRecord) throws Exception {
		return (int) this.getDaoSupport().update("T_ReviewRecord.updateManualReview", reviewRecord);
	}
	
	public int updateReviewState(ReviewRecord reviewRecord) throws Exception {
		return (int) this.getDaoSupport().update("T_ReviewRecord.updateReviewState", reviewRecord);
	}

	public int updateRecordReviewState(ReviewRecord reviewRecord) throws Exception {
		return (int) this.getDaoSupport().update("T_ReviewRecord.updateRecordReviewState", reviewRecord);
	}
	
	public int deleteRecordReviewState(ReviewRecord reviewRecord) throws Exception {
		return (int) this.getDaoSupport().update("T_ReviewRecord.deleteRecordReviewState", reviewRecord);
	}
	
	public int deleteReviewRecord(ReviewRecord reviewRecord) throws Exception {
		return (int) this.getDaoSupport().update("T_ReviewRecord.deleteReviewRecord", reviewRecord);
	}
	
	public int saveReviewRecord(List<ReviewRecord> reviewRecordList, String userID) throws Exception {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("UserID", userID);
		map.put("reviewRecordList", reviewRecordList);
    	return (int)this.getDaoSupport().save("T_ReviewRecord.saveReviewRecord", map);
    }
	
	@SuppressWarnings("unchecked")
	public List<ReviewRecord> searchPhaseSummary(ChargingRecord chargingRecord) throws Exception{
		return (List<ReviewRecord>)this.getDaoSupport().findForList("T_ReviewRecord.searchPhaseSummary", chargingRecord);
	}
	
	@SuppressWarnings("unchecked")
	public List<ReviewRecord> searchEntryStatistics(ReviewRecord reviewRecord) throws Exception{
		return (List<ReviewRecord>)this.getDaoSupport().findForList("T_ReviewRecord.getEntryStatistics", reviewRecord);
	}
}
